<%--
  Created by IntelliJ IDEA.
  User: yangbushudemao
  Date: 2021/5/4
  Time: 8:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/common/common.jsp" %>
<html>
  <head>
    <title>登陆页面</title>
  </head>
  <body>
  <form id="denglu">
    账号:<input type="text" name="uname">
    密码:<input type="password" name="pwd">
    <input type="button" value="登陆" onclick="denglu()">
    <input type="button" value="注册" onclick="zhuce()">

  </form>
  <a href="<%=path%>/UserController/bootstra1ps">bootstraps</a>
  </body>
</html>
<script>
  function denglu() {
    $.ajax({
      url:"<%=path%>/UserController/denglu",
      type:"post",
      data:$("#denglu").serialize(),
      datatype:"json",
      async:false,
      success:function (canshu) {
        if(canshu == 1){
          //等于成功展示
          alert("登陆成功跳转展示页面");
          location.href="<%=path%>/UserController/bootstra1ps";
        }else if(canshu == 2){
          //冻结
          alert("冻结")
        }else if(canshu == 3){
          //账号密码不对
          alert("账号密码不对")
        }else if(canshu == 0){
          alert("账号不存在")
        }
      },
      error:function () {
      alert("代码错误")
      }
    })
  }
  function zhuce() {
    location.href="<%=path%>/UserController/zhuce"
  }
</script>
